package com.alks.function.controller;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.dto.pcCollectUser.PcCollectUser2DeptDto;
import com.alks.function.data.dto.pcCollectUser.PcCollectUser2Dto;
import com.alks.function.data.request.pcCollectUser.CollectUserRequest;
import com.alks.function.service.PcCollectUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@Slf4j
@Api(value = "系统-管理模块-系统参数设定", tags = {"系统-平板采集用户设置"})
@ApiRestController("/pcCollectUser")
//@RoleCheck(prgIds = {"56080401"})
public class PcCollectUserController {
    @Autowired
    private PcCollectUserService pcCollectUser2Service;


    @WebLogger
    @PostMapping("/getCollectUser")
    @ApiOperation(value = "查询采集用户",tags = "系统-平板采集用户设置")
    public ResponseInfo getCollectUser(@RequestBody CollectUserRequest request){
        return pcCollectUser2Service.getCollectUser(request);
    }

    @WebLogger
    @GetMapping("/getDeptByCollectUser")
    @ApiOperation(value = "根据采集用户查部门",tags = "系统-平板采集用户设置")
    public ResponseInfo getDeptByCollectUser(@RequestParam String id ){
        return pcCollectUser2Service.getDeptByCollectUser(id);
    }

    @WebLogger
    @PostMapping("/addCollectUser")
    @ApiOperation(value = "添加采集用户",tags = "系统-平板采集用户设置")
    public ResponseInfo addCollectUser(@RequestBody PcCollectUser2Dto request){
        return pcCollectUser2Service.addCollectUser(request);
    }

    @WebLogger
    @GetMapping("/deleteCollectUser")
    @ApiOperation(value = "删除采集用户",tags = "系统-平板采集用户设置")
    public ResponseInfo deleteCollectUser(@RequestParam String id ){
        return pcCollectUser2Service.deleteCollectUser(id);
    }

    @WebLogger
    @PostMapping("/updateCollectUser")
    @ApiOperation(value = "修改采集用户",tags = "系统-平板采集用户设置")
    public ResponseInfo updateCollectUser(@RequestBody PcCollectUser2Dto request){
        return pcCollectUser2Service.updateCollectUser(request);
    }

    @WebLogger
    @PostMapping("/addCollectDept")
    @ApiOperation(value = "添加采集部门",tags = "系统-平板采集用户设置")
    public ResponseInfo addCollectDept(@RequestBody PcCollectUser2DeptDto request){
        return pcCollectUser2Service.addCollectDept(request);
    }

    @WebLogger
    @PostMapping("/deleteCollectDept")
    @ApiOperation(value = "删除采集部门",tags = "系统-平板采集用户设置")
    public ResponseInfo deleteCollectDept(@RequestBody PcCollectUser2DeptDto request){
        return pcCollectUser2Service.deleteCollectDept(request);
    }

    @WebLogger
    @PostMapping("/updateCollectDept")
    @ApiOperation(value = "修改采集部门",tags = "系统-平板采集用户设置")
    public ResponseInfo updateCollectDept(@RequestBody PcCollectUser2DeptDto request){
        return pcCollectUser2Service.updateCollectDept(request);
    }

}
